<template>
	<view>
		<Barcode v-if="barcodeshow" :opations="opations">暂无条形码</Barcode>
	</view>
</template>

<script>
	import Barcode from "@/components/Barcode/Barcode.vue"

	export default {
		components: {
			Barcode
		},
		data() {
			return {
				barcodeshow: false, //等待接口返回完毕再加载条形码
				opations: {
					width: 3,
					height: 48,
					textMargin: 4,
					fontSize: 20,
					fontColor: '#000',
					lineColor: '#000',
					background: 'transparent',
					margin: 0,
					marginBottom: 3,
				},
			}
		},


		methods: {

			userLogon() {
				var that = this
				let params = {
					openId: 'opF2s4mml7jHMH_7qv-CkVGsYzZY',
					status: 2,
					nickname: '',
					headUrl: ''
				}
				that.$api.userLogon(params).then(res => {
						let result = res.data.data;
						that.barcodeshow = true;
						that.$set(that.opations, "text", result.couponCode); //赋值code
					})
					.catch(err => {
						that.$u.toast(err);
					});
			},

		},

		mounted() {
			this.userLogon()
		},


	}
</script>

<style lang="scss" scoped>

</style>